<?php
   include_once('../../src/classes/class.mysql.php');
    
    $comtec_id_owner = $_GET['id'];
   
    $db = new MySQL();
    
    $texto = "SELECT cod_owner,
		     company_name,
		     rut,
		     address,
                     phone,
		     contact_name,
		     contact_lastname1,            
                     contact_lastname2,
		     contact_position,                   
		     email
		     FROM owner
                     WHERE comtec_id_owner=".$comtec_id_owner;
    
    $result = $db->fetch_array($db->query($texto));  
   
    $cod_owner=$result['cod_owner'];
    
    $phone=$result['phone'];
    
    $contact_name = $result['contact_name'];
    $contact_lastname1 = $result['contact_lastname1'];
    $contact_lastname2 = $result['contact_lastname2'];
    $contact_position  = $result['contact_position'];  
    
    $rut = $result['rut'];   
    $rut_cod = substr($rut, -1, 1);
    $rut = substr($rut,0,strlen($rut)-1);
    
    $company_name = $result['company_name'];
    $address = $result['address'];
    
    $email = $result['email'];
?>
<fieldset class="curved">
 <legend>Ver</legend>
  <table style="margin: 10px auto; border-spacing: 10px;">
   <tr>
    <td width="200">C&oacute;digo</td>
    <td><input type="text" size="40" DISABLED value="<?=$cod_owner;?>"/></td>
    <td width="200">Nombre</td>
    <td><input type="text" size="40" DISABLED value="<?=$company_name;?>"/></td>
   </tr>  
   <tr>
    <td width="200">RUT</td>
    <td><input type="text" size="34" DISABLED value="<?=$rut;?>"/>-<input type="text" size="1" DISABLED value="<?=$rut_cod;?>"/></td>
    <td width="200">Direcci&oacute;n</td>
    <td><input type="text" size="40" DISABLED value="<?=$address;?>"/></td>
   </tr>
   <tr>
    <td width="200">Nombre Contacto</td>
    <td><input type="text" size="40" DISABLED value="<?=$contact_name;?>"/></td>
    <td width="200">Apellido Paterno Contacto</td>
    <td><input type="text" size="40" DISABLED value="<?=$contact_lastname1;?>"/></td>
   </tr> 
   <tr> 
    <td width="200">Apellido Materno Contacto</td>
    <td><input type="text" size="40" DISABLED value="<?=$contact_lastname2;?>"/></td>   
   </tr>
   <tr>
    <td width="200">Cargo Contacto</td>
    <td><input type="text" size="40" DISABLED value="<?=$contact_position;?>"/></td>
    <td width="200">Tel&eacute;fono Contacto</td>
    <td><input type="text" size="40" DISABLED value="<?=$phone;?>"/></td>
   </tr>
   <tr> 
    <td width="200">Correo electr&oacute;nico</td>
    <td><input type="text" size="40" DISABLED value="<?=$email;?>"/></td>   
   </tr>
   <tr><td><input type="button" value="Regresar" onclick="javascript:loadOwners();" /></td></tr>
    </table>              
    </fieldset>
